#include "pipelinecheckdlg.h"
#include <QMessageBox>

PipelineCheckDlg::PipelineCheckDlg(QWidget* parent)
	: QDialog(parent)
{
	ui.setupUi(this);
}

PipelineCheckDlg::~PipelineCheckDlg()
{}

bool PipelineCheckDlg::Init(QList<Pipeline*> pipes)
{
	for (auto& iter : pipes) {
		auto temp = new PipelineInfoWid(iter, this);
		temp->hide();
		m_wid.append(temp);
		temp->hide();
	}
	return true;
}

bool PipelineCheckDlg::StartReset()
{
	ui.tabWidget->clear();
	for (auto& iter : m_wid) {
		if (iter->IsNeedReset()) {
			ui.tabWidget->addTab(iter, iter->GetName());
		}
	}
	if (ui.tabWidget->count() == 0) {
		return true;
	}

	return (exec() == 10086);
}

void PipelineCheckDlg::on_pushButton_clicked()
{
	auto ret = QMessageBox::question(this, "问题", "请确认所有业务线处理完成，系统启动将无法处理");
	if (ret == QMessageBox::StandardButton::Yes) {
		this->done(10086);
	}
}
